-- Inserting a Single Row into a Table
INSERT INTO HumanResources.Department
VALUES (N'Administrative Support', N'Executive General and Administration', GETDATE());



-- Inserting Multiple Rows into a Table
INSERT INTO HumanResources.Department
VALUES (N'Quality Control', N'Quality Assurance', GETDATE()),
       (N'Technical Support', N'Research and Development', GETDATE());



-- Inserting Values into Identity Columns
CREATE TABLE dbo.T1 ( column_1 int IDENTITY, column_2 VARCHAR(30));
INSERT T1 VALUES ('Row #1');
INSERT T1 (column_2) VALUES ('Row #2');
SET IDENTITY_INSERT T1 ON;
INSERT INTO T1 (column_1,column_2) 
    VALUES (-99, 'Explicit identity value');
SELECT column_1, column_2
FROM T1;



-- Using the OUTPUT Clause with the INSERT Statement
DECLARE @MyTableVar table( ScrapReasonID smallint,
                           Name varchar(50),
                           ModifiedDate datetime);
INSERT Production.ScrapReason
    OUTPUT INSERTED.ScrapReasonID, INSERTED.Name, INSERTED.ModifiedDate
        INTO @MyTableVar
VALUES (N'Operator error', GETDATE());
--Display the result set of the table variable.
SELECT ScrapReasonID, Name, ModifiedDate FROM @MyTableVar;
--Display the result set of the table.
SELECT ScrapReasonID, Name, ModifiedDate 
FROM Production.ScrapReason;
